home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / bbs / PagEr.lha / PagE!r / SysopAvail.rexx < prev   
OS/2 REXX Batch file  |  1996-11-10  |  2KB  |  82 lines

  1. /*************************************************************************/
  2. /*                   SysopAvail.rexx v1.0  by Morpheus                   */
  3. /*                                                                       */
  4. /*          Utility to set/reset the sysop-avail flag for PagE!r         */
  5. /*                                                                       */
  6. /*          Usage: "rx SysopAvail.rexx 20 40" to open the window         */
  7. /*               at position (20,40), default is (448,112)               */
  8. /********************************* Script ********************************/
  9. options results
  10. parse arg x y .
  11. def_x=448
  12. def_y=112
  13. avail_flag=1
  14. call setclip('SysopAvail','TRUE')
  15. host='AVAILHOST'
  16. port='AVAILPORT'
  17. if ~show(l,'rexxarplib.library') then;do
  18. if ~addlib("rexxarplib.library",0,-30,0) then;do
  19. say "Can't open rexxarplib.library"
  20. exit
  21. end
  22. end
  23. if ~show(l,'rexxsupport.library') then;do
  24. if ~addlib("rexxsupport.library",0,-30,0) then;do
  25. say "Can't open rexxsupport.library"
  26. exit
  27. end
  28. end
  29. MaxCols=ScreenCols()-192
  30. MaxRows=ScreenRows()-52
  31. if ~datatype(x,W) then x=def_x
  32. if ~datatype(y,W) then y=def_y
  33. if x<0 then x=0
  34. if y<0 then y=0
  35. if x>MaxCols then x=MaxCols
  36. if y>MaxRows then y=MaxRows
  37. address AREXX "'call CreateHost("host","port")'"
  38. do 50 while ~show('P',host)
  39. call delay(10)
  40. end
  41. if ~show('P',host) then;do
  42. call Request(112,100,'Error: Could not create controlport for SysopAvail',,' OKAY ',,)
  43. exit
  44. end
  45. idcmp='GADGETUP+CLOSEWINDOW'
  46. flags='WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE'
  47. call OpenWindow(host,x,y,192,52,idcmp,flags,"SysopAvail v1.0")
  48. call AddGadget(host,12,36,1,' Avail ',1)
  49. call AddGadget(host,87,36,2,' Not Avail ',2)
  50. call Show_Text
  51. quitflag=0
  52. call openport(port)
  53. do until quitflag=1
  54. call waitpkt(port)
  55. packet=getpkt(port)
  56. if packet ~=null() then;do
  57. cmd=getarg(packet)
  58. select
  59. when cmd=CLOSEWINDOW then quitflag=1
  60. when cmd='1' then;do
  61. avail_flag=1
  62. call setclip('SysopAvail','TRUE')
  63. call Show_Text
  64. end
  65. when cmd='2' then;do
  66. avail_flag=0
  67. call setclip('SysopAvail','FALSE')
  68. call Show_Text
  69. end
  70. otherwise nop
  71. end
  72. call reply(packet,0)
  73. end
  74. end
  75. call setclip('SysopAvail')
  76. call CloseWindow(host)
  77. call ClosePort(port)
  78. exit
  79. Show_Text:
  80. if avail_flag=1 then call WindowText(host,"Sysop is available!")
  81. else call WindowText(host,"Sysop not available")
  82. return